Humanize distance intl#358
Merged
binh-dam-ibigroup merged 2 commits intoopentripplanner:masterfrom Mar 16, 2022
Merged
Conversation
Merged
Collaborator
Author
|
With #355 merged, this PR is now ready for review @philip-cline cc: @fpurcell. |
philip-cline
approved these changes
Mar 16, 2022
miles-grant-ibigroup
approved these changes
Mar 16, 2022
Collaborator
miles-grant-ibigroup
left a comment
There was a problem hiding this comment.
More than I expected but looks good to me and works well in my (limited) testing!
Comment on lines
+23
to
+25
| unit = "mile"; | ||
| unitIfNoIntl = abbreviate ? "mi" : "miles"; | ||
| value = roundToOneDecimalPlace(feet / 5280); |
Collaborator
There was a problem hiding this comment.
We could probably clean this up a bit if we used these values as the default case for those lets
Comment on lines
51
to
55
| } else { | ||
| unit = "meter"; | ||
| shortUnit = "m"; | ||
| value = Math.round(meters); | ||
| } |
Collaborator
There was a problem hiding this comment.
We could probably clean this up a bit if we used these values as the default case for those lets
| let unitIfNoIntl; | ||
|
|
||
| if (feet < 528) { | ||
| unit = "foot"; |
Collaborator
There was a problem hiding this comment.
Am I right in thinking that formatMessage will re-write foot?
Collaborator
Author
There was a problem hiding this comment.
That is correct.
Collaborator
Author
There was a problem hiding this comment.
It will also use the correct decimal separator.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requires #355 (for an updated correct dependency version).Update: #355 is now merged in master.This PR adds i18n support to the
humanize-distancepackage while maintaining backwards compatibility (use ofreact-intlremains optional with this package).